namespace flickr.api.communication
{
	public class FlickrConnectionManager
	{
		private FlickrConnectionManager() {}

        public static string ApiKey;
        public static string ApiToken;
        public static string SharedSecret;
	    private static FlickrConnection _currentConnection;
	    private static Flickr _flickrApi;

	    public static FlickrConnection CurrentConnection
	    {
	        get 
            { 
                if (_currentConnection == null || (_currentConnection.ApiToken != ApiToken))
	            {
    	            _currentConnection = new FlickrConnection(ApiKey, SharedSecret, ApiToken);
                } 
                return _currentConnection;
            }
	    }

        public static Flickr FlickrApi
        {
            get
            {
                if (_flickrApi == null)
                {
                    _flickrApi = new Flickr(CurrentConnection);
                }
                return _flickrApi;
            }
        }
	}
}
